package com.taobao.search.feignclient;

import com.taobao.base.model.RestResponse;
import com.taobao.search.model.dto.GoodsDto;
import com.taobao.search.model.dto.StoreDto;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;

/**
 *远程调用搜索接口
 */
//使用fallback定义降级类是无法拿到熔断异常,使用FallbackFactory可以拿到熔断的异常信息
@FeignClient(value = "home-api",fallbackFactory = HomeServiceClientFallbackFactory.class)
public interface HomeServiceClient {

    /**
     * 查询所有
     */
    @GetMapping("/home/goods/getAllGoods")
    RestResponse<List<GoodsDto>> getAllGoods();


    /**
     * 根据店铺id获取店铺信息
     */
    @GetMapping("/home/store/getStoreById/{storeId}")
     RestResponse<StoreDto> getStoreById(@PathVariable("storeId")Integer storeId);

}
